<div class="container">  
	<div id="home">
		<div class="page-header" style="position:relative;">
			<h3>Dashboard</h3>
		</div>
                
		<div class="content-home">
			<div class="overview">
        		<div class="dashboard-heading">Overview</div>
                <div class="dashboard-content">
                  <table class="list">
                    <tbody>
                    	<tr>
                          <td>Total Sales:</td>
                          <?php $order_total = $this->common_model->getTotalSales(); ?>
                          <td class="right"><?php echo 'Rp '.number_format($order_total->total_sales,2,',','.') ?></td>
                        </tr>
                        <tr>
                          <td>Total Sales This Year:</td>
                          <?php $get_total = $this->common_model->getTotalSalesByYear(date('Y')); ?>
                          <td class="right"><?php echo 'Rp '.number_format($get_total->total_sales_year,2,',','.') ?></td>
                        </tr>
                        <tr>
                          <td>Total Sales (Status Order Paid):</td>
                          <?php $order_total = $this->common_model->getTotalSalesPaid(); ?>
                          <td class="right"><?php echo 'Rp '.number_format($order_total->total_sales,2,',','.') ?></td>
                        </tr>
                        <tr>
                          <td>Total Sales This Year (Status Order Paid):</td>
                          <?php $get_total = $this->common_model->getTotalSalesPaidByYear(date('Y')); ?>
                          <td class="right"><?php echo 'Rp '.number_format($get_total->total_sales_year,2,',','.') ?></td>
                        </tr>
                        <tr>
                          <td>Total Customer:</td>
                          <?php $customer = $this->common_model->getTotalCustomer(); ?>
                          <td class="right"><?php echo $customer->customer ?></td>
                        </tr>
                        <tr>
                          <td>Total Customer This Year:</td>
                          <?php $get_total = $this->common_model->getTotalCustomerByYear(date('Y')); ?>
                          <td class="right"><?php echo $get_total->total_customer_year ?></td>
                        </tr>
                    </tbody>
                  </table>
                </div>
            </div>
            <div class="statistic">
                <div class="range">Select Range:          
                    <select id="range" onchange="getSalesChart(this.value)">
                        <option value="day">Today</option>
                        <option value="week">This Week</option>
                        <option value="month">This Month</option>
                        <option value="year">This Year</option>
                    </select>
                </div>
                <div class="dashboard-heading">Statistics</div>
                <div class="dashboard-content">
                    
                </div>
            </div>
            <div class="latest">
                <div class="dashboard-heading">Latest 10 Orders</div>
                <div class="dashboard-content">
                <?php $hasil = $this->common_model->getAll() ?>
                  	<?php
					if(empty($hasil)){
							echo "<table class='table table-striped'>
									<thead>
										<tr>
											<td>Order Code</td>
											<td>Order Id</td>
											<td>Customer</td>
											<td>Status</td>
											<td>Total</td>
											<td>Date Add</td>
										</tr>
									  </thead>
								</table>";
					}else{
					?>
					<table class="table table-striped">
						<thead>
							<tr>
								<td width="1" style="text-align: center;"><input name="checkbox[]" id="checkbox[]" class="chk_boxes" type="checkbox" value="" /></td>
								<td>Order Code</td>
								<td>Order Id</td>
								<td>Customer</td>
								<td>Status</td>
								<td>Total</td>
								<td>Date Add</td>
								<td>Action</td>	
							</tr>
						</thead>              
							<?php foreach ($hasil as $row): ?>
							<tr>
								<td width="1" style="text-align: center;"><input name="checkbox[]" id="checkbox[]" class="chk_boxes1" type="checkbox" value="$row -> order_id" /></td>
								<td> <?php echo $row->order_cid; ?></td>
								<td> <?php echo $row->order_id; ?></td>
								<td> <?php echo $row->firstname; ?> <?php echo $row->lastname ?> </td>
								<?php $order_status = $this->common_model->get_order_status(); ?>
								<?php foreach ($order_status as $status){?>
									<?php if ($status->order_status_id == $row->order_status_id) {?>
										<td> <?php echo $status->name;?> </td>
									<?php } ?>
								<?php } ?>
								<td> <?php echo number_format($row->total);?> </td>
								<td> <?php echo $row->date_added;?> </td>
								<td> <a href="<?php echo site_url('order/info/'.$row->order_id);?>" title="View"><i class="icon-list-alt"></i></a>  <!--<a href="<?php echo site_url('order/update/'.$row->order_id);?>" title="Edit"><i class="icon-edit"></i></a>--></td>
							</tr>
							<?php endforeach; ?> 
					</table>
					<?php
					}
					?>
                </div>
        	</div>
     	</div>
    </div>
</div>

        
       
